import {deviceready} from './common';

export async function executeSql(sql) {
    await deviceready;
    const db = window.sqlitePlugin.openDatabase('database.db');
    return new Promise((resove, reject) => {
        db.readTransaction(function (txn) {
            txn.executeSql(sql, [], function (tx, res) {
                resove(res.rows._array);
            });
        }, reject);
    });
}